#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>

using namespace std;

class Solution
{
public:
    vector<int> path;
    vector<vector<int>> ret;
    int n, k;
    vector<vector<int>> combine(int _n, int _k)
    {
        n = _n, k = _k;
        dfs(1);
        return ret;
    }
    void dfs(int pos)
    {
        if (path.size() == k)
        {
            ret.push_back(path);
            return;
        }

        for (int i = pos; i <= n; i++)
        {
            path.push_back(i);
            dfs(i + 1);
            path.pop_back();
        }
    }
};